﻿using System.Windows;

namespace EmlViewer.Viewers
{
    public partial class HtmlViewer 
    {
        public HtmlViewer()
        {
            InitializeComponent();
        }
        #region HtmlContent (DependencyProperty)
        public string HtmlContent
        {
            get { return (string)GetValue(HtmlContentProperty); }
            set { SetValue(HtmlContentProperty, value); }
        }
        public static readonly DependencyProperty HtmlContentProperty =
            DependencyProperty.Register("HtmlContent", typeof(string), typeof(HtmlViewer),
              new PropertyMetadata{PropertyChangedCallback = BrowserStringChanged});
        private static void BrowserStringChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            HtmlViewer viewer = d as HtmlViewer;
            if (viewer != null)
            {
                if (e.NewValue as string != null)
                {
                    viewer.Browser1.NavigateToString(e.NewValue as string);
                }
            }
        }
        #endregion
    }
}
